<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>摄像头识别</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            margin: 0;
            padding: 20px;
            text-align: center;
        }
        
        .camera-container {
            max-width: 800px;
            margin: 0 auto;
        }
        
        #video {
            width: 100%;
            max-width: 640px;
            border: 2px solid #3498db;
            border-radius: 8px;
        }
        
        .btn {
            background: #3498db;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            margin: 10px;
        }
        
        .btn:hover {
            background: #2980b9;
        }
        
        .result {
            margin-top: 20px;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 8px;
        }
    </style>
</head>
<body>
    <div class="camera-container">
        <h1>摄像头实时识别</h1>
        <img id="video" src="{{ url_for('video_feed') }}">
        
        <div>
            <button class="btn" onclick="captureImage()">拍照识别</button>
            <button class="btn" onclick="window.location.href='/'">返回</button>
        </div>
        
        <div id="captureResult" class="result" style="display: none;">
            <h3>识别结果</h3>
            <p id="captureClass"></p>
            <p id="captureConfidence"></p>
        </div>
    </div>

<!--    <script>-->
<!--        function captureImage() {-->
<!--            // 这里可以添加拍照后的处理逻辑-->
<!--            // 实际应用中可以通过Canvas捕获当前视频帧并发送到服务器-->
<!--            -->
<!--            // 模拟结果显示-->
<!--            document.getElementById('captureResult').style.display = 'block';-->
<!--            document.getElementById('captureClass').textContent = '识别中...';-->
<!--            document.getElementById('captureConfidence').textContent = '';-->
<!--            -->
<!--            // 模拟延迟后显示结果-->
<!--            setTimeout(() => {-->
<!--                document.getElementById('captureClass').textContent = '识别结果: 当归';-->
<!--                document.getElementById('captureConfidence').textContent = '置信度: 92%';-->
<!--            }, 1000);-->
<!--        }-->
<!--    </script>-->
</body>
</html>